package felix.rule.service.queue;

import felix.rule.data.msg.EngineMsgCallback;
import felix.rule.data.msg.RuleEngineException;

public class TQueueMsgCallbackWrapper implements TQueueCallback {

    private final EngineMsgCallback msgCallback;

    public TQueueMsgCallbackWrapper(EngineMsgCallback msgCallback) {
        this.msgCallback = msgCallback;
    }

    @Override
    public void onSuccess(TQueueMsgMetadata metadata) {
        msgCallback.onSuccess();
    }

    @Override
    public void onFailure(Throwable t) {
        msgCallback.onFailure(new RuleEngineException(t.getMessage()));
    }
}
